<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /**
         * 数据类型
         */ 
        // var name = 'tom'
        // var name = "tom"
        var name = `tom`
        console.log(typeof name)

        var age = 18
        var height = 183.5
        console.log(typeof height)

        console.log(name-1)

        var isOk = true // false
        console.log(typeof isOk)
        

        var address = null 
        var hobby
        console.log(address)
        console.log(hobby) // undefined 未定义值

        // console.log(sex) // 报错：ReferenceError: sex is not defined


        /**
         * 数据类型转换
         */ 
        // 将数值转换为字符串
        var a = 8
        console.log(typeof a)

        a = a + ''
        console.log(typeof a)

        // 其他类型转换为boolean
        console.log(Boolean(0))
        console.log(Boolean(''))
        console.log(Boolean(null))
        console.log(Boolean(undefined))
        console.log(Boolean(NaN))
    </script>
</head>
<body>
    
</body>
</html>